package com.tourism.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.tourism.admin.model.entity.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
@Mapper
public interface BookMapper extends BaseMapper<Book> {
    // 根据用户id查询图书信息
    @Select("select t_book.*,t_user.nick_name from t_book left join t_user on t_book.user_id = t_user.id where t_book.user_id = #{userId}")
    List<Book> findByUserId(@Param("userId") Integer userId);
}
